package com.yichen.rent.controller;

import com.yichen.rent.service.StatisticService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/statistic")
public class StatisticController {

    @Autowired
    private StatisticService statisticService;

    @RequestMapping("/house/rent")
    public Result cityRentCount() {
        return new Result(true, StatusCode.OK,"查询成功",statisticService.cityHouseCount());
    }

    @RequestMapping("/house/new")
    public Result cityNewCount() {
        return new Result(true, StatusCode.OK,"查询成功",statisticService.cityNewHouseCount());
    }

    @RequestMapping("/house/old")
    public Result cityOldCount() {
        return new Result(true, StatusCode.OK,"查询成功",statisticService.cityOldHouseCount());
    }


    @RequestMapping("/house/map/rent")
    public Result rentMapHouse() {
        return new Result(true, StatusCode.OK,"查询成功",statisticService.locationMapCountRent());
    }

    @RequestMapping("/house/map/rent/county")
    public Result rentMapHouseCounty() {
        return new Result(true, StatusCode.OK,"查询成功",statisticService.locationMapCountRentCounty());
    }

    @RequestMapping("/house/map/new/county")
    public Result newMapHouseCounty() {
        return new Result(true, StatusCode.OK,"查询成功",statisticService.locationMapCountNewCounty());
    }

    @RequestMapping("/house/map/old/county")
    public Result oldMapHouseCounty() {
        return new Result(true, StatusCode.OK,"查询成功",statisticService.locationMapCountOldCounty());
    }
}
